<?php
/*
 +----------------------------------------------------------------------
 + Title        : Sell 控制器
 + Author       : Randy_chen
 + Version      : V1.0.0.1
 + Initial-Time : 2019/8/24 9:52
 + Last-time    : 2019/8/24 9:52+ 86187
 + Desc         : Sell
 +----------------------------------------------------------------------
*/


namespace app\admin\behavior;


use app\common\service\TemplateMessageService;

class Sell
{
    //小票推送通知钩子
    public function notify($data){
        try {
           $this->sendMessage($data);
            return true;
        } catch (\Exception $e) {
            return true;
        }
    }

    //推送模板消息
    public function sendMessage($data){

        $url = url('home/member/sellList', '', true, true);
        $data = [
            $data['member']['openid'],
            $data['member']['username'],
            $data['sell']['shop_name'],
            date('Y-m-d H:i:s'),
            $data['sell']['shop_name'],
            '销售',
            $data['sell']['shfactpay'],
            $data['sell']['change'],
            '查看积分请至会员中心',
        ];
        $tmp = new TemplateMessageService();
        return $tmp->send('CUST_SELL', $data, $url);
    }
}